package org.bigjava.novelplatform.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.io.Serializable;
import java.util.List;

/**
 * 
 * @TableName catalog
 */
@TableName(value ="catalog")
@Data
public class Catalog implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 父分类id
     */
    private Integer parenCatalogId;

    /**
     * 分类层级
     0，1，2
     */
    @Min(0)
    @Max(2)
    private Integer catalogLevel;

    /**
     * 分类名,不可重复,限制为15字符
     */
    @Length(max = 30)
    private String catalogName;

    /**
     *
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)//不为空时返回
    @TableField(exist = false)
    private List<Catalog> children;

    /**
     * 逻辑删除
     0未删除；1删除
     */
    private Integer deleteState;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

}